# -*- coding: utf-8 -*-

class JiraReopen(object):

    def __init__(self, _list):
        self._id            = _list[0 ]
        self._rootcause     = _list[1 ]
        self._fix_discrip   = _list[2 ]
        self._update_time   = _list[3 ]
        self._fixVersion    = _list[4 ]
        self._howtocheck    = _list[5 ]
        self._checkdiscrip  = _list[6 ]
        self._handler       = _list[7 ]
        self._updater       = _list[8 ]
        self._result        = _list[9 ]
        self._check_time    = _list[10]
        self._status        = _list[11]
        print(_list)
        self.needdraw = False

    def update(self, _list):
        self._rootcause     = _list[1 ]
        self._fix_discrip   = _list[2 ]
        self._update_time   = _list[3 ]
        self._fixVersion    = _list[4 ]
        self._howtocheck    = _list[5 ]
        self._checkdiscrip  = _list[6 ]
        self._handler       = _list[7 ]
        self._updater       = _list[8 ]
        self._result        = _list[9 ]
        self._check_time    = _list[10]
        self._status        = _list[11]
    
    def printparam(self):
        print(' IssueReOpen : \n RootCause : {0} \n FixDiscrip : {1} \n UpdateTime : {2} \n FixVersion : {3} \n HowCheck : {4} \n Handler : {5} \
         \n CheckDiscrip: {6} \n CheckTime : {7} \n Result : {8} \n Updater : {9} \n Status : {10}'.format(self._rootcause, self._fix_discrip, self._update_time, 
                                                                        self._fixVersion, self._howtocheck, self._handler, 
                                                                        self._checkdiscrip, self._check_time, self._result, self._updater, self._status))


class JiraIssue(object):

    def __init__(self):
        self.reopenList = []
        _tlist = []
        for i in range(0,17):
            _tlist.append('')
        self.insertParam(_tlist)
        self.needdraw = False

    def insertParam(self, _list):
        if len(_list) != 17:
            return
        # print(_list)
        self._key           = _list[0]
        self._type          = _list[1]
        self._create_time   = _list[2]
        self._version       = _list[3]
        self._discrip       = _list[4]
        self._ctreater      = _list[5]
        self._rootcause     = _list[6]
        self._fix_discrip   = _list[7]
        self._update_time   = _list[8]
        self._fixVersion    = _list[9]
        self._howtocheck    = _list[10]
        self._checkdiscrip  = _list[11]
        self._handler       = _list[12]
        self._updater       = _list[13]
        self._result        = _list[14]
        self._check_time    = _list[15]
        self._status        = _list[16]

        # if (self._key != ''):
    
    def printparam(self):
        print(' Issue : {0} \n Type : {1} \n Created: {2} \n Version : {3} \n Discrip : {4} \n Creater : {5} \n RootCause : {6} \n FixDiscrip : {7} \n UpdateTime : {8} \n FixVersion : {9} \n HowCheck : {10} \n Handler : {11} \n CheckDiscrip: {12} \n CheckTime : {13} \n Result : {14} \n Updater : {15} \n Status : {16}'.format(self._key, self._type, self._create_time, 
                                                                        self._version, self._discrip, self._ctreater, 
                                                                        self._rootcause, self._fix_discrip, self._update_time, 
                                                                        self._fixVersion, self._howtocheck, self._handler, 
                                                                        self._checkdiscrip, self._check_time, self._result, self._updater, self._status))
        print("=======================================================================================================")
        for reopen in self.reopenList:
            reopen.printparam()
        print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")

    def appendReopen(self, reopen):
        self.reopenList.append(reopen)
        # print(' Issue : {0} \n Type : {1} \n Created: {2} \n Version : {3} \n Discrip : {4} \n Creater : {5} \n RootCause : {6} \n FixDiscrip : {7} \n UpdateTime : {8} \n FixVersion : {9} \n HowCheck : {10} \n Handler : {11} \n CheckDiscrip: {12} \n CheckTime : {13} \n Result : {14} \n Updater : {15} \n Status : {16}'.format(self._key, self._type, self._create_time, 
        #                                                                     self._version, self._discrip, self._ctreater, 
        #                                                                     reopen._rootcause, reopen._fix_discrip, reopen._update_time, 
        #                                                                     reopen._fixVersion, reopen._howtocheck, reopen._handler, 
        #                                                                     reopen._checkdiscrip, reopen._check_time, reopen._result, reopen._updater, reopen._status))

    def reopencount(self):
        return len(self.reopenList)
